<template>
      <el-main class="main">
        <el-row>
          <el-col :span="24" class="col6"><projectTable @change="getData"></projectTable></el-col>
        </el-row>
        <!-- 第一列栅格布局 -->
        <el-row>
          <el-col :span="16" class="col1"><p-table :project="project"></p-table></el-col>
          <el-col :span="6" push="2" class="col2"><allscore :score="score"></allscore></el-col>
        </el-row>
        <!-- 第二列布局 -->
        <el-row>
          <el-col :span="8" class="col3"><instrumentPanel :score="score"></instrumentPanel></el-col>
          <el-col :span="8" class="col4"><scoreAnalysis :score="score"></scoreAnalysis></el-col>
          <el-col :span="8" class="col5"><weightAndIndex :score="score"></weightAndIndex></el-col>
        </el-row>
        <el-row>
          <el-col :span="24" class="col6"><tableData :score="score" @refresh="getData"></tableData></el-col>
        </el-row>
      </el-main>
</template>

<script>
import ProjectTable from "./pass/projectTable.vue";
import PTable from "./pass/ptable.vue";
import TableData from "./pass/tableData.vue";
import WeightAndIndex from "./pass/weightAndIndex.vue";
import ScoreAnalysis from "./pass/scoreAnalysis.vue";
import InstrumentPanel from "./pass/instrumentPanel.vue";
import Allscore from "./pass/allscore.vue";

export default {
  components: {
    ProjectTable,
    PTable,
    TableData,
    WeightAndIndex,
    ScoreAnalysis,
    InstrumentPanel,
    Allscore,
  },

  name: "Assess",
  data() {
    return {
			project: {
				id: 0,
				name: '',
				projectType: '',
				projectPerson: '',
				thisDept: '',
				allScore: 0.0
			},
			score: {
				id: 0,
				preTimeRateScore: 0.0,
				preDefectRateScore: 0.0,
				prePersonCostRateScore: 0.0,
				timeRateScore: 0.0,
				defectRateScore: 0.0,
				personCostRateScore: 0.0,
				allScore: 0.0,
				projectId: 0,
				timeRate: 0.0,
				defectRate: 0.0,
				personCostRate: 0.0,
				timeWeight: 0.0,
				defectWeight: 0.0,
				personCostWeight: 0.0,
				timeCoefficient: 0.0,
				defectCoefficient: 0.0,
				personCostCoefficient: 0.0
			}
		};
  },
  methods: {
	  getData(id) {
		  this.$axios.get(`http://localhost:8089/project/card/${id}`).then((resp) => {
			  this.project = resp.data.data.project
		  })
		  this.$axios.get(`http://localhost:8089/score/detail/${id}`).then((resp) => {
			  let data = resp.data.data
			  console.info(data.scoreDTO)
			  this.score = data.scoreDTO
		  })
	  }
  },
  mounted() {
  	this.getData(1)
  }
};
</script>

<style scoped>
el-main{
  overflow: auto;
  position:relative;
  height:100%!important;
  overflow-x: hidden;
  overflow-y: scroll;
}
.main{
  height:100%;
}
</style>
